<?php

defined('RUN_MODULE') or define('RUN_MODULE', 'backend');

require(__DIR__ . '/../../env.php');
require __DIR__ . '/../../vendor/autoload.php';
require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php';
require __DIR__ . '/../../common/config/bootstrap.php';
require __DIR__ . '/../../console/config/bootstrap.php';

//配置文件优先级：公共 < 环境.公共 < 环境.模块
$config = yii\helpers\ArrayHelper::merge(
    require __DIR__ . '/../../common/config/main.php',
    require(__DIR__ . '/../../environments/' . YII_ENV . '/common/config/main-local.php'),
    require(__DIR__ . '/../../environments/' . YII_ENV . '/'.RUN_MODULE.'/config/main-local.php')
);

(new yii\web\Application($config))->run();
